import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:moose_app/core/utils/navigate_util.dart';
import 'package:moose_app/ui/screens/video/video_screen.dart';
import 'package:moose_app/ui/values/values.dart';

class CircleItem extends StatelessWidget {
  const CircleItem(this.imageUrl, this.index);

  final String imageUrl;
  final int index;

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: () {
        ATHNavigator.pushFromRight(context, ATHVideoScreen.routeName);
      },
      child: Container(
        margin: EdgeInsets.only(top: kSize16),
        child: Column(
          children: <Widget>[
            index % 2 == 0
                ? CachedNetworkImage(imageUrl: imageUrl)
                : Container(
                    height: kSize400,
                    width: MediaQuery.of(context).size.width / 2,
                    child: CachedNetworkImage(
                      imageUrl: imageUrl,
                      fit: BoxFit.fitWidth,
                    ),
                  ),
            Padding(
              padding: const EdgeInsets.all(4.0),
              child: Column(
                children: <Widget>[
                  Text(
                    index % 2 == 0
                        ? "每个人都有自己故事，只是演绎的方式不同。"
                        : '不为昨天烦恼，不为明天迷惘，只为今天更美好，别指望永远，永远最不可靠，很多时候，幸福转瞬即逝，变化无处不在。',
                    style: const TextStyle(color: Colors.grey),
                    maxLines: 2,
                    overflow: TextOverflow.ellipsis,
                  ),
                  Container(
                    margin: EdgeInsets.only(top: kSize10),
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        Row(
                          children: [
                            ClipRRect(
                              borderRadius: BorderRadius.circular(kSize24),
                              child: Container(
                                width: kSize48,
                                height: kSize48,
                                color: kColorPrimaryLight,
                                child: Image.asset(
                                    "assets/images/avatar_girl.png"),
                              ),
                            ),
                            Container(
                              margin: EdgeInsets.only(left: kSize8),
                              child: Text(
                                '有故事的人儿',
                                style: TextStyle(),
                              ),
                            ),
                          ],
                        ),
                        Row(
                          children: [
                            SvgPicture.asset(
                              "assets/icons/icon_heart.svg",
                              width: kSize30,
                            ),
                            Text("167"),
                          ],
                        )
                      ],
                    ),
                  )
                ],
              ),
            )
          ],
        ),
      ),
    );
  }
}
